ABC154 D - Dice in Line
提出
TLE
code: python
n, k = map(int, input().split())
p = list(map(int, input().split()))
except_values = []
for i in range(n):
res = 0
res += j
except_values.append(res / pi) ans = -1
for i in range(n-k+1):
res = sum(except_valuesi:i+k) if (res > ans):
ans = res
print(ans)
解答
code: python
n, k = map(int, input().split())
p = list(map(int, input().split()))
except_values = []
for i in range(n):
except_values.append((pi + 1) / 2) ans = sum(except_values:k) res = ans
for i in range(k, n):
res = res + except_valuesi - except_valuesi-k if res > ans:
ans = res
print(ans)
テーマ
メモ
提出
code: python
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
exception = []
for i in range(1, 1001):
exc = 0.0
for j in range(1, i+1):
exc += j * (1/i)
exception.append(exc)
# 合計が多い範囲を求めたい
# 17 13 13 12 15 20 10 13 17 11
# t r
ans = -1
tmp = 0.0
# 0 ~ 3
for i in range(k):
# 4~
for i in range(k, len(p)):
res = tmp
if res > ans:
ans = res
if ans == -1:
print(tmp)
else:
print(ans)
メモ
方針は合ってる